package com.lsp.server.product.service;

import com.lsp.server.product.domain.po.ProductBrand;
import com.lsp.server.product.mapper.BrandMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @ClassName ProductService
 * @Description 品牌业务层
 * @Author Mr Hao
 * @Date 2021/11/25 16:10
 */
@Service
public class BrandService {
    @Autowired
    private BrandMapper brandMapper;

    /**
     * 查询品牌数据
     * @return
     */
    public Object getBrand() {
        List<ProductBrand> brands = brandMapper.getBrand();
        if (brands == null){
            return "";
        }
        return brands;
    }

    /**
     * 新增品牌
     * @param form
     */
    public void addBrand(ProductBrand form) {
        form.setCreateDate(new Date());
        brandMapper.addBrand(form);
    }
}
